package com.compass.mobile.ui.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.compass.mobile.R
import com.compass.mobile.databinding.FragmentSpecialColumnBinding
import com.compass.mobile.framework.base.BaseVBActivity
import com.compass.mobile.ui.fragment.DoctorSpecialColumnFragment
import com.compass.mobile.ui.fragment.LectureColumnFragment

/**
 * Description：医生专栏-医生首页
 * Date:2024/6/4 13:57
 */
class DoctorSpecialColumnActivity : BaseVBActivity<FragmentSpecialColumnBinding>() {


    companion object {
        fun start(context: Context) {
            val intent = Intent(context, DoctorSpecialColumnActivity::class.java)
            context.startActivity(intent)
        }
    }
    private lateinit var lectureColumnFragment: LectureColumnFragment
    private lateinit var doctorInfoFragment: DoctorSpecialColumnFragment
    override fun initView(savedInstanceState: Bundle?) {
        lectureColumnFragment = LectureColumnFragment()
        displayChildFragment(lectureColumnFragment)


        doctorInfoFragment = DoctorSpecialColumnFragment()
        displayDoctorFragment(doctorInfoFragment)

    }

    // 根据需要显示或替换Fragment
    private fun displayDoctorFragment(fragment: Fragment) {
        val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
        fragmentTransaction.replace(R.id.fragmentDoctor, fragment)
        fragmentTransaction.commit()
    }

    // 根据需要显示或替换Fragment
    private fun displayChildFragment(fragment: Fragment) {
        val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
        fragmentTransaction.replace(R.id.fragmentChild, fragment)
        fragmentTransaction.commit()
    }
}